import 'package:high_help_apps/common/entities/life_help/user/user_release_commodity_request_entity.dart';

userReleaseCommodityRequestEntityFromJson(UserReleaseCommodityRequestEntity data, Map<String, dynamic> json) {
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['original_price'] != null) {
		data.originalPrice = json['original_price'] is String
				? double.tryParse(json['original_price'])
				: json['original_price'].toDouble();
	}
	if (json['current_price'] != null) {
		data.currentPrice = json['current_price'] is String
				? double.tryParse(json['current_price'])
				: json['current_price'].toDouble();
	}
	if (json['desc'] != null) {
		data.desc = json['desc'].toString();
	}
	if (json['commodity_images'] != null) {
		data.commodityImages = (json['commodity_images'] as List).map((v) => v is String
				? int.tryParse(v)
				: v.toInt()).toList().cast<int>();
	}
	return data;
}

Map<String, dynamic> userReleaseCommodityRequestEntityToJson(UserReleaseCommodityRequestEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['title'] = entity.title;
	data['original_price'] = entity.originalPrice;
	data['current_price'] = entity.currentPrice;
	data['desc'] = entity.desc;
	data['commodity_images'] = entity.commodityImages;
	return data;
}